package month4.day5.computer;

public class PC {
    private String brand;
    private int money;
    private CPU cpu;
    private EMS ems;
    private HardDisk hardDisk;
    private Usb usb;

    public PC() {

    }

    public void show(){
        System.out.println("这台电脑牌子是："+brand+"，价格是"+money+"元");
        System.out.println("CPU:"+cpu);
        System.out.println("EMS:"+ems);
        System.out.println("HardDisk:"+hardDisk);
        System.out.println(usb);
    }
    public void work(){
        System.out.println(brand+"在工作");
        if(cpu!=null)
            cpu.work();
        if(ems!=null)
            ems.work();
        if(hardDisk!=null)
            hardDisk.work();
        if(usb!=null)
            usb.work();
    }

    public PC(String brand, int money, CPU cpu, EMS ems, HardDisk hardDisk,Usb usb) {
        this.brand = brand;
        this.money = money;
        this.cpu = cpu;
        this.ems = ems;
        this.hardDisk = hardDisk;
        this.usb=usb;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public CPU getCpu() {
        return cpu;
    }

    public void setCpu(CPU cpu) {
        this.cpu = cpu;
    }

    public EMS getEms() {
        return ems;
    }

    public void setEms(EMS ems) {
        this.ems = ems;
    }

    public HardDisk getHardDisk() {
        return hardDisk;
    }

    public void setHardDisk(HardDisk hardDisk) {
        this.hardDisk = hardDisk;
    }

    public Usb getUsb() {
        return usb;
    }

    public void setUsb(Usb usb) {
        this.usb = usb;
    }
}
